package servlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

    public class HelloServlet extends HttpServlet {
        /**
		 * 
		 */
		private static final long serialVersionUID = 816071945847920808L;

		protected void doGet(HttpServletRequest request, HttpServletResponse response) 	throws ServletException, IOException {
        	response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            response.setStatus(HttpServletResponse.SC_OK);
            response.getWriter().println("<h1>Hello and Welcome!</h1>");
            
            out.println("<html><head>");
            out.println("<script language=\"Javascript\">");
            out.println("  function printTime(time) {");
            out.println("document.getElementById('text').innerHTML = time;");
            out.println("  }");
            out.println("</script>");
            		out.println("</head>");
            				out.println("<body>");
            				out.println("<iframe id=\"iframe\" name=\"iframe\" width =\"0\" height =\"0\" border=\"0\">");
            				out.println("</iframe>");

            				out.println("<a href =\"time\" target=\"iframe\">start timer</a>");
            				out.println("<p id=\"text\">0</p>");
            				out.println("</body>");
            				out.println("</html>");

        }
    }

